#include<stdio.h>  
#include<algorithm>  
#include<vector>  
using namespace std;  
vector<int>v;  
int f_number(int x);  
int main()  
{  
    int x,n;  
    scanf("%d",&n);  
    while(n--)  
    {  
        scanf("%d",&x);  
        v.push_back(f_number(x));  
    }  
    sort(v.begin(),v.end());  
    v.erase(unique(v.begin(),v.end()),v.end());  
    int number = v.size();  
    printf("%d\n",number);  
    for(int i=0 ; i<number ; i++)  
    {  
        printf("%d%c",v[i],i==number-1?'\n':' ');  
    }  
}  
int f_number(int x)  
{  
    int sum = 0;  
    while(x)  
    {  
        sum += x%10;  
        x/=10;  
    }  
    return sum;  
}  
